home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d8
/
ragtag_3.arc
/
RAGTAG.SLT
< prev
next >
Wrap
Text File
|
1990-04-12
|
6KB
|
127 lines
// RagTag, version 0.03
//
// Telix script for adding taglines to messages written online,
// using the John Hancock (JH) program, version 2.
//
// Written by Maurice Crouse, 29 March 1990.
// Revision 0.02 written 2 April 1990.
// Revision 0.03 written 12 April 1990.
//
// See RAGTAG.DOC file for documentation on how to use this script.
str tag [50] = "", //holds tagline from JH;
logo [] = " * RagTag 0.03 * ", //holds RagTag logo;
tear_line [] = "---", //holds the "tear line";
enter [] = "^M", //equate for Carriage Return;
space [] = " ", //equate for Space character;
jh_dir [64] = "", //JH directory;
tlx_dir [64] = "", //Telix directory;
change_tlx [68] = "cd ", //holds first change string;
change_jh [68] = "cd "; //holds second change string;
main ()
{
int stat = 0; //local variable;
stat = read_cnf (); //try to read configuration file;
if (stat == -1 ) //if error in opening file or setting
{ //JH variable, try to find JH in
if (filefind ("jh.exe",0) == 0) //current directory;
{ //if unsuccessful,
status_wind ("Can't find JH. Sorry, no tagline.");
return; //quit with apology;
}
}
if (stat == -2)
status_wind ("Won't be able to get back to Telix directory.",15);
status_wind ("Calling JH to get tagline.",15);
if (get_tag () == -1) //try to get tag; if error,
status_wind ("Sorry, can't add the tagline.",15); //admit it;
else //otherwise,
{
cputs (space); //enter a blank line,
cputs (enter);
cputs (tear_line); //send the "tear line,"
cputs (enter);
cputs (logo); //send the logo,
cputs (tag);
cputs (enter); //and send the tagline;
}
}
read_cnf ()
{
int f = 0, //local variables;
stat = 0;
f = fopen ("ragtag.cnf","r"); //open RAGTAG.CNF for reading;
if (not f) //if an error in reading it,
{
status_wind ("Can't open configuration file.",15);
status_wind ("Will try to find JH in current directory.",15);
fclose (f); //close RAGTAG.CNF;
return -1; //return error -1;
}
stat = fgets (jh_dir, 64, f); //set JH directory variable;
if (stat == -1) //if unsuccessful,
{
status_wind ("Can't find JH directory information.",15);
status_wind ("Will try to find JH in current directory.",15);
fclose (f); //close RAGTAG.CNF;
return -1; //return error -1;
}
stat = fgets (tlx_dir, 64, f); //set Telix directory variable;
if (stat == -1) //if unsuccessful,
{
status_wind ("Can't find Telix directory information.",15);
fclose (f); //close RAGTAG.CNF;
return -2; //return error -2;
}
fclose (f); //close RAGTAG.CNF;
}
get_tag ()
{
int f = 0, //local variables;
dir_changed = 0,
stat = 0;
if (not (jh_dir == "")) //if the JH directory is defined
{ //in RAGTAG.CNF,
strcat (change_jh, jh_dir);
dos (change_jh); //change directory;
dir_changed = 1; //set "changed" flag;
}
dos ("if exist jh?.rep del jh?.rep"); //erase any old .REP file;
if (run ("jh","",0) == -1) //run the JH program;
{ //if an error in running it,
status_wind ("Can't run JH.",15); //admit it;
goto got_error;
} //rename the .REP file created by
dos ("if exist jh?.rep ren jh?.rep jhx.rep"); //JH2 to JHX.REP;
f = fopen ("jhx.rep","r"); //open JHX.REP for reading;
if (not f) //if an error in reading it,
{ //admit it;
status_wind ("Can't find the tagline file.",15);
goto got_error;
}
stat = fgets (tag, 80, f); //copy JHX.REP into tag array;
if (stat == -1) //if unsuccessful,
{ //admit it;
status_wind ("Can't get a copy of the tagline.",15);
goto got_error;
} //if we get this far, no errors;
fclose (f); //close JHX.REP;
if (dir_changed == 1)
{ //if directory was changed
strcat (change_tlx,tlx_dir); //earlier,
dos (change_tlx); //change directory back to Telix;
}
return 1; //return success code;
got_error: //if we end here, error was made;
fclose (f); //close JHX.REP;
if (dir_changed == 1)
{ //if directory was changed
strcat (change_tlx,tlx_dir); //earlier,
dos (change_tlx); //change directory back to Telix;
}
return -1; //return error code;
} //END OF SCRIPT